home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
xfalib.lha
/
XFA_Library
/
Blitz
/
XFA2IFF.ascii
< prev
next >
Wrap
Text File
|
1995-06-21
|
2KB
|
98 lines
;********************************************************************
;
; (c) Mik of ClassX 1995
;
;
; Simple XFA -> Iff converter (may also be a simple disk player)
;
;
;********************************************************************
XINCLUDE "LIB_XFA.BB"
WBStartup
NoCli
DEFTYPE.l
DEFTYPE.XFA_Head *hd
DEFTYPE.Mem mem
DEFTYPE.IFFHandle *iff
DEFTYPE.BitMap *bm0,*bm1
DEFTYPE.Screen *sc0,*sc1
DEFTYPE.w mode
DEFTYPE.l cnt
;/* xfa file to convert */
f$ = "df0:X32I.xfa"
;/* open the file for reading */
*iff = XFA_OpenRead_(f$,0,0)
If *iff
;/* open the screen buffer to unpack frames */
;/* only 1 bitmap required for XFA_MODEI animations */
*hd = XFA_HeadPtr_
mode = XFA_GetPackMode_ & #XFA_MODEI
Screen 0,0,0,*hd\BytesPerRow*8,*hd\Rows,*hd\Depth,*hd\ModeID,"",2,1
ScreensBitMap 0,0
Cls 0
*sc0 = Peek.l(Addr Screen (0))
*bm0 = Addr BitMap (0)
XFA_UseCMap_ *sc0,0
;/* open another buffer for no lace cunning anims */
If mode = 0
Screen 1,0,0,*hd\BytesPerRow*8,*hd\Rows,*hd\Depth,*hd\ModeID,"",2,1
ScreensBitMap 1,1
Cls 0
*sc1 = Peek.l(Addr Screen (1))
*bm1 = Addr BitMap (1)
XFA_UseCMap_ *sc1,0
EndIf
cnt = 0
Format "00000"
;/* while not eof, create the frames */
While XFA_ReadFrame_(*iff,&mem)=0
;/* first field */
XFA_UnPackBitMap_ *bm0,mem\Ptr
XFA_FreeFrame_ &mem
;/* second field on the same bitmap for XFA_MODEI */
If mode
If XFA_ReadFrame_(*iff,&mem)=0
XFA_UnPackBitMap_ *bm0,mem\Ptr
XFA_FreeFrame_ &mem
EndIf
EndIf
;;/* put here the code to save every single frame */
XFA_SaveScreen_ *sc0,"t:frame"+Str$(cnt)
;;
If mode=0
Exchange *sc0,*sc1
Exchange *bm0,*bm1
EndIf
cnt+1
Wend
;/* done with the file /*
XFA_CloseRead_ *iff
EndIf
End
;Note: this code saves also the last LOOP/BLANK frames.
;******************************************************